﻿/******************************************************************************
 * 
 * Announce: CSharpKit, Basic algorithms, components and definitions.
 *           Copyright (C) ShenYongchen.
 *           All rights reserved.
 *   Author: 申永辰.郑州 (shenyczz@163.com)
 *  WebSite: http://github.com/shenyczz/CSharpKit
 *
 * THIS CODE IS LICENSED UNDER THE MIT LICENSE (MIT).
 * THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
 * IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
 * PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 * 
******************************************************************************/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace CSharpKit.Numerics.LinearAlgebra
{
    // Vector.Operators
    partial class Vector<T>
    {
        public static Vector<T> operator +(Vector<T> rhs) => rhs.Clone();
        public static Vector<T> operator -(Vector<T> rhs) => rhs.Negate();

        // Add(+)
        public static Vector<T> operator +(Vector<T> lhs, T scalar) => lhs.Add(scalar);
        public static Vector<T> operator +(T scalar, Vector<T> rhs) => rhs.Add(scalar);
        public static Vector<T> operator +(Vector<T> lhs, Vector<T> rhs) => lhs.Add(rhs);

        // Subtract(-)
        public static Vector<T> operator -(Vector<T> lhs, T scalar) => lhs.Subtract(scalar);
        public static Vector<T> operator -(T scalar, Vector<T> rhs) => rhs.SubtractFrom(scalar);
        public static Vector<T> operator -(Vector<T> lhs, Vector<T> rhs) => lhs.Subtract(rhs);

        // Multiply(*)
        public static Vector<T> operator *(Vector<T> lhs, T scalar) => lhs.Multiply(scalar);
        public static Vector<T> operator *(T scalar, Vector<T> rhs) => rhs.Multiply(scalar);
        public static T operator *(Vector<T> lhs, Vector<T> rhs) => lhs.DotProduct(rhs);

        // Divide(/)
        public static Vector<T> operator /(Vector<T> lhs, T divisor) => lhs.Divide(divisor);
        public static Vector<T> operator /(T dividend, Vector<T> rhs) => rhs.DivideByThis(dividend);
        public static Vector<T> operator /(Vector<T> dividend, Vector<T> divisor) => dividend.PointwiseDivide(divisor);


        // Modulo(%)
        public static Vector<T> operator %(Vector<T> dividend, T divisor) => dividend.Modulus(divisor);
        public static Vector<T> operator %(T dividend, Vector<T> divisor) => divisor.ModulusByThis(dividend);
        public static Vector<T> operator %(Vector<T> dividend, Vector<T> divisor) => dividend.Modulus(divisor);

        //public static Vector<T> operator %(Vector<T> dividend, T divisor) => dividend.Remainder(divisor);
        //public static Vector<T> operator %(T dividend, Vector<T> divisor) => divisor.RemainderByThis(dividend);
        //public static Vector<T> operator %(Vector<T> dividend, Vector<T> divisor) => dividend.PointwiseRemainder(divisor);



        [SpecialName]
        public static Vector<T> op_DotMultiply(Vector<T> x, Vector<T> y) => x.PointwiseMultiply(y);

        [SpecialName]
        public static Vector<T> op_DotDivide(Vector<T> dividend, Vector<T> divisor)
        {
            return dividend.PointwiseDivide(divisor);
        }

        [SpecialName]
        public static Vector<T> op_DotPercent(Vector<T> dividend, Vector<T> divisor)
        {
            return dividend.PointwiseRemainder(divisor);
        }

        //[SpecialName]
        //public static Vector<T> op_DotHat(Vector<T> vector, Vector<T> exponent)
        //{
        //    return vector.PointwisePower(exponent);
        //}

        //[SpecialName]
        //public static Vector<T> op_DotHat(Vector<T> vector, T exponent)
        //{
        //    return vector.PointwisePower(exponent);
        //}


        // 逐点操作
        //













        //}}@@@
    }


}

